package ControlLayer;
import java.util.ArrayList;
import ModelLayer.*;
/**
 * Controller class for the address book
 * 
 * @author (kbh) 
 * @version (2005.03.31)
 * (FEN): 2006.03.21: Some changes to the architecture in order to assure layering
 *                    and loose coupling
 */
public class AddressCtr
{
    
    //declare instance variables to reference containers
   
    private Adressebog adressebog;
   
    public AddressCtr(/*---*/)
    {
        adressebog = new Adressebog();
    }
    
    //Dummy implementation: after implementing the model layer 
    //objects of class Person are to be returned, not String
    public Person getPerson(String id)
    {
        //this method is to search the container for a person
        //with an id-number equal to the parameter id
        //when person is found, the method is to call print-methods in the TUI layer
       return  adressebog.getPersons(id);
       
    }
    
    
    public void opretPerson(String id, String navn, String addresse, String postNr, String by, String tlf)
    {   
        Person p = new Person (id, navn, addresse, postNr, by, tlf);
        adressebog.addPerson(p);
    }
    
    public void deletePerson(String id)
    {
        adressebog.removeFile(id);
    }
    
     public void updatePerson(String id, String navn, String adresse, String postNr, String by, String tlf)
    {
        adressebog.setPerson(id, navn, adresse, postNr, by, tlf);
    }
    
    public void listAllPersons()
    {
          adressebog.listAllPersons();
    }
}
